package com.kong.jobs;

import com.alibaba.dubbo.config.annotation.Reference;
import com.kong.service.OrderSettingService;
import com.kong.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author yang2013
 * @data 2020/10/20 12:14
 */
public class ClearOrderSettingJob {
    private static Logger logger = LoggerFactory.getLogger(ClearOrderSettingJob.class);
    @Reference
    private OrderSettingService orderSettingService;
    public void clearSetting(){
        try {
            String date = DateUtils.parseDate2String(DateUtils.getToday(), "yyyy-MM-dd");
            System.out.println("=======清理日期=======");
            orderSettingService.deleteOrderSetting(date);
            logger.info("清空历史预约数据失败");
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("更新历史预约数据失败",e.getMessage());
        }
    }
}
